
using System.Collections;
using System.Collections.Generic;
using Xeno.Core;
namespace QuantumEngine
{

    public class GameObj
    {

        public string Name { get; set; }
        public string Copyright { get; set; }
        public string Info { get; set; }
        public GameObj Parent { get; set; }
        public List<GameObj> Actors = new List<GameObj>();
        public Dictionary<string, GameObj> ActorsMap = new Dictionary<string, GameObj>();
        public XenoNode NodeRoot { get; set; }
        public QuestKind Kind { get; set; }
        public GameObj()
        {
            Kind = QuestKind.Group;
            Name = "(Obj) New";
            Info = "";
            Copyright = "(c)Binary Arch 2011";
            Parent = null;
        }
        public void AddActor(GameObj a)
        {
            this[Actors.Count] = a;
        }
        public GameObj this[string name]
        {

            get
            {
                return ActorsMap[name];
            }
            set
            {
                if (ActorsMap.ContainsKey(name))
                {
                    ActorsMap.Remove(name);
                }
                ActorsMap.Add(name, value);
                if (!Actors.Contains(value))
                {
                    Actors.Add(value);
                }
            }
        }
        public GameObj this[int index]
        {
            get
            {
                return Actors[index];
            }
            set
            {
                if (index >= Actors.Count)
                {
                    Actors.Add(value);
                }
                Actors[index] = value;
                if (ActorsMap.ContainsKey(value.Name))
                {
                    ActorsMap.Remove(value.Name);

                }
                ActorsMap.Add(value.Name, value);
            }

        }
    }

}

    